package com.sx.baseproject.module

import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.mvvm.base.data.DataBindingConfig
import com.gyf.immersionbar.ImmersionBar
import com.sx.baseproject.R
import com.sx.baseproject.databinding.ActSplashBinding
import com.sx.baseproject.framework.app.MyActivity
import com.sx.baseproject.framework.arouth.RouteManager
import kotlinx.android.synthetic.main.act_splash.*

/**
 * @Description
 * @Author 梁浩文
 * @Date 2021/6/25 13:38
 */
class SplashActivity : MyActivity<ActSplashBinding>() {
    override fun getDataBindingConfig(): DataBindingConfig = DataBindingConfig(R.layout.act_splash)

    override fun initView() {
        ImmersionBar.with(this).statusBarDarkFont(true).init()
    }

    override fun initData() {

        var alphaAnimation = AlphaAnimation(0.5f, 1.0f)
        alphaAnimation.duration = 3000
        splash_image.animation = alphaAnimation;
        alphaAnimation.start()
        alphaAnimation.setAnimationListener(object : Animation.AnimationListener {
            override fun onAnimationStart(animation: Animation?) {

            }

            override fun onAnimationEnd(animation: Animation?) {
                RouteManager.getInstance().intentToMain(this@SplashActivity)
            }

            override fun onAnimationRepeat(animation: Animation?) {
            }

        })

    }
}


